package com.fjut.kms.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import com.fjut.kms.domain.UserActSoft;
import com.fjut.kms.tools.DBTools;
import com.fjut.kms.domain.softwaresNzx;
public class softNzxJdbcImpl implements softNzx {

	 private static final String SQL_GET_KMSSEVER="select category,kmsserver from softwares";
	 public    List<softwaresNzx> getKmsServers(){
	        Connection conn= DBTools.getConn();
	        PreparedStatement pstmt=null;
	        ResultSet rset=null;
	        List<softwaresNzx> l=new ArrayList<softwaresNzx>(); 
	        try{
	            pstmt =conn.prepareStatement(SQL_GET_KMSSEVER);
	            rset=pstmt.executeQuery();
	            while (rset.next()){
	            	softwaresNzx s=new softwaresNzx();
	                s.setcategory(rset.getString("category"));
	                s.setcategory(rset.getString("kmsserver"));
	                l.add(s);
	            }
	            return l;
	        } catch (SQLException e){
	            e.printStackTrace();
	            return null;
	        }finally {
	            DBTools.releaseRes(conn,pstmt,null);
	            return null;
	        }
	    }
}
